import java.util.Date;

public class Test {
	public static void main(String[] args) {
		// 包装类型，不可变类型
		Integer b = new Integer(2);
		calculate2(b);
		System.out.println(b);

		// 日期类型，目标方法改变对象值，当前日期2013-09-24
		Date d1 = new Date();
		claculate3(d1);
		System.out.println(d1);
		System.out.println("d1 hashCode:\t" + d1.hashCode());

		// 日期类型，目标方法仅读取对象值，当前日期2013-09-24
		Date d2 = new Date();
		calculate4(d2);
		System.out.println(d2);
		System.out.println("d2 hashCode:\t" + d2.hashCode());
	}

	public static void calculate2(Integer param) {
		param += 3;
		System.out.println(param);
	}

	public static void claculate3(Date date) {
		date.setDate(date.getDate() + 1);
		System.out.println(date);
		System.out.println("\nclaculate3 hashCode:\t" + date.hashCode());
	}

	public static void calculate4(Date date) {
		date = new Date(date.getYear(), date.getMonth(), date.getDate() + 1);
		System.out.println(date);
		System.out.println("\nclaculate4 hashCode:\t" + date.hashCode());
	}
}
